# 读取yaml文件
# 参考：https://zhuanlan.zhihu.com/p/644393484
import yaml

def read_yaml(file_path):
    with open(file=file_path, mode="r", encoding='utf-8') as f:
        res = yaml.safe_load(f)
        return res

def write_yaml(data, save_path):
    with open(file=save_path, mode="w", encoding="utf-8") as f:
        yaml.dump(data, f, allow_unicode=True)

if __name__ == '__main__':
    # 读取文件
    res = read_yaml(file_path="../configs/config.yaml")
    print(res)

    write_yaml(res, "../configs/test_example.yaml")